package com.demo2do.sms.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Condition;
import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.QueryTarget;
import com.demo2do.core.persistence.annotation.Save;
import com.demo2do.core.persistence.annotation.Variable;
import com.demo2do.sms.entity.sms.SmsCompany;
import com.demo2do.sms.entity.sms.SmsRecord;

/**
 * 
 * @author mohanlan
 *
 */
@Dao
public interface SmsDao {
    
    /**
     * 
     * @param smsRecord
     */
    @Save("INSERT INTO sms_record(client, mobile, content, create_time, send_time, delay_seconds, result) VALUES( :client, :mobile, :content, :createTime, :sendTime, :delaySeconds, :result)")
    public void save(SmsRecord smsRecord);
    
    /**
     * 
     * @param alias
     * @return
     */
    @QueryTarget(SmsCompany.class)
    @Condition("WHERE alias = :alias")
    public SmsCompany loadCompany(@Variable("alias") String alias);
    
    /**
     * 
     * @param id
     * @return
     */
    @QueryTarget(SmsRecord.class)
    @Condition("WHERE id = :id")
    public SmsRecord loadRecord(@Variable("id") Long id);
    
    /**
     * 
     * @param ids
     * @return
     */
    @QueryTarget(SmsRecord.class)
    @Condition("WHERE id in (:ids)")
    public List<SmsRecord> list(@Variable("ids") List<Long> ids);
}
